#include <iostream>

using namespace std;

const int N = 1e6 + 10;

typedef long long LL;

LL q[N], s[N];
LL maxv;

int n, k;

int main()
{
	cin >> n >> k;
	
	for (int i = 1; i < n; i ++ ) cin >> q[i];
	
	for (int i = 1; i < n; i ++ ) 
	{
		s[i] = s[i - 1] + q[i];
//		sum += q[i];	
	}
	
	for (int i = 0; i + k < n; i ++ )
	{
		maxv = max(maxv, s[i + k] - s[i]);
	}
	
	cout << s[n - 1] - maxv << endl;
	
	return 0;
}
